# 华为笔试题q1
# 最长不重复子串
# leetcode 第3题

def longeststr(s):
    if len(s)<3:
        return len(set(s))
    maxcount=1
    i=0
    j=1
    while True:
        flag=0
        # 这种情况下i只能小于等于j
        while s[j] in s[i:j]:
            flag=1
            i+=1
        if flag==0:
            j+=1
        if j-i>maxcount:
            maxcount=j-i
        if j==len(s):
            break
    return maxcount

def main():
    s=""
    res=longeststr(s)
    print(res)

main()